package com.iwhalecloud.bss.kite.cucc.web.service.goods.modify;

import com.iwhalecloud.bss.kite.cucc.client.api.goods.IGoodsModifyService;
import com.iwhalecloud.bss.kite.cucc.web.service.goods.modify.impl.AbstractGoodsModifyService;
import com.ztesoft.bss.common.util.SpringUtil;

import java.util.Objects;

public final class GoodsModifyServiceFactory {
    public static IGoodsModifyService getInstance() {
        return getInstance(GoodsModifyServiceEnum.DEFAULT_GOODS_CATAGORY);
    }

    public static IGoodsModifyService getInstance(GoodsModifyServiceEnum goodsModifyServiceEmun) {
        if (Objects.isNull(goodsModifyServiceEmun)) {
            goodsModifyServiceEmun = GoodsModifyServiceEnum.DEFAULT_GOODS_CATAGORY;
        }
        Class<? extends AbstractGoodsModifyService> clazz = goodsModifyServiceEmun.getClazz();
        return (IGoodsModifyService) SpringUtil.getBean(clazz);
    }
}
